package core;

import java.awt.Point;
import java.util.ArrayList;

public class Vendor {
    
    public final String NAME;
    private ArrayList<Machine> machinesForRent;
    private Point posVendor = new Point();
    public static int distance;
    
    public Vendor(String name, int machinesForRentCount) {
        NAME = name;
        machinesForRent = new ArrayList<Machine>();
    }
    
    public void setPoint(int x, int y){
        posVendor.x = x;
        posVendor.y = y;
    }
    
    public Point getPoint(){
        return posVendor;
    }
    
    public void addMachinesForRent(int machineType) {
        boolean found = false;
        for(int i=0;i<machinesForRent.size();i++) {
            if(machinesForRent.get(i).TYPE == machineType) {
                found = true;
                break;
            }
        }
        if(!found)
            machinesForRent.add(Factory.getInstance().getMachineByType(machineType));
    }
    
    public ArrayList<Machine> getAllMachinesForRent() {
        return machinesForRent;
    }    
}